﻿public partial class Program
{
    static async Task SignalRClientTest()
    {
        //var url = "http://localhost:5010/defaultHub";
        var url = "http://172.20.60.9:5170/hub/signal";
        var conn = new HubConnectionBuilder().WithUrl(url, options=>options.Headers.Add("X-Device-ID", "1123")).Build();
        conn.Closed += async (error) =>
        {
            Console.WriteLine("连接关闭");
            await Task.CompletedTask;
        };

        _ = conn.On<dynamic>("ReceiveBeltState", message =>
        {
        });

        _ = conn.On<int, dynamic[]>("ReceiveBeltDeviceVideoInfo", (beltDeviceId, videos) =>
        {
            Console.WriteLine("皮带ID：{0}", beltDeviceId);
        });

        await conn.StartAsync();
        await conn.InvokeAsync("SendMessage");

    }
}
